﻿@model Exception

@{
	Layout = "~/Views/Shared/_ErrorLayout.cshtml";
	ViewBag.Title = "Error";
	ViewBag.Subtitle = "Sorry, an unexpected error occurred while processing your request.";
}

@helper RenderMessage(Exception exception)
{
	if (exception == null)
	{
		return;
	}

	<p>@exception.GetType().Name: @exception.Message.Replace("\n", "<br />")</p>

	if (exception.InnerException != null)
	{
		@RenderMessage(exception.InnerException)
	}
}

@helper RenderStackTrace(Exception exception)
{
	if (exception == null)
	{
		return;
	}

	if (exception.InnerException != null)
	{
		@RenderStackTrace(exception.InnerException)
	}

	<p>@exception.StackTrace</p>
}

<section>
	@if (Request.IsLocal && Model != null)
	{
		<h4>Exception:</h4>
		@RenderMessage(Model)

		<h4>Stack Trace:</h4>
		@RenderStackTrace(Model)
	}
	else
	{
		<div class="block">
			<div class="center">
				@Html.Image(Url.Content("~/Content/images/kitten-will-fix-it.jpg"))
			</div>
		</div>
	}
</section>